package main

import (
	"fmt"
	"log"
	"os"
	"os/signal"

	"cron-go/configs"
	"cron-go/internal/app/server"
	"cron-go/internal/pkg/crontab/job"

	"github.com/joho/godotenv"
)

func main() {
	err := godotenv.Load()
	if err != nil {
		fmt.Printf("[INFO].env:%+v\n", err)
	}
	configs.InitConfig()
	job.RunJob()
	//select {} //阻塞主线程停止
	server.RunHTTP(":" + configs.EnvConfig.ServiceHttpPort)
	quit := make(chan os.Signal, 1)
	signal.Notify(quit, os.Interrupt)
	<-quit
	log.Println("Shutdown Server ...")
}
